using Godot;

namespace Arcane.Source.UI
{
    public partial class RuneEquipSlot : Control
    {
        [Export] TextureRect rune;

        [Signal]
        public delegate void OnClickEventHandler();

        public override void _GuiInput(InputEvent e)
        {
            if (e is InputEventMouseButton mbe)
            {
                if (!mbe.Pressed)
                {
                    EmitSignal(SignalName.OnClick);
                }
            }
        }

        public void SetRune(Texture2D texture, Color themeColor)
        {
            rune.Texture = texture;
            SelfModulate = themeColor;
        }

        public void Unset()
        {
            rune.Texture = null;
            SelfModulate = new Color(0.08f, 0.08f, 0.08f);
        }
    }
}